#include "Mutate.h"
#include <stdlib.h>
#include <time.h>

Mutate::Mutate()
{
	prob=0.1;
}

Mutate::Mutate(double p):prob(p)
{}

Mutate::~Mutate()
{}

void Mutate::run(vector<int>& gene, vector<int>& limit)
{
	int pInt=prob*10;
	srand(clock());
	if(rand()%10<pInt)
	{
		int index=rand()%gene.size();
		gene[index]=rand()%limit[index];
	}
}